From: Keir Fraser Date: Tue, 29 Dec 2009 15:11:47 +0000 (+0000) Subject: x86: Initialise percpu areas as early as possible during bootstrap. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12811 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=7f370406ddd64a44fa207c5b14f9725842e9bf22;p=xen.git x86: Initialise percpu areas as early as possible during bootstrap. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index b3de1fd04a..38a0f5cd39 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -202,21 +202,32 @@ extern char __per_cpu_start[], __per_cpu_data_end[]; static void __init percpu_init_areas(void) { unsigned int i, data_size = __per_cpu_data_end - __per_cpu_start; - unsigned int first_unused; BUG_ON(data_size > PERCPU_SIZE); /* Initialise per-cpu data area for all possible secondary CPUs. */ - for ( i = 1; (i < NR_CPUS) && cpu_possible(i); i++ ) + for ( i = 1; i < NR_CPUS; i++ ) memcpy(__per_cpu_start + (i << PERCPU_SHIFT), __per_cpu_start, data_size); +} + +static void __init percpu_free_unused_areas(void) +{ + unsigned int i, data_size = __per_cpu_data_end - __per_cpu_start; + unsigned int first_unused; + + /* Find first 'impossible' secondary CPU. */ + for ( i = 1; i < NR_CPUS; i++ ) + if ( !cpu_possible(i) ) + break; first_unused = i; /* Check that there are no holes in cpu_possible_map. */ for ( ; i < NR_CPUS; i++ ) BUG_ON(cpu_possible(i)); + /* Free all unused per-cpu data areas. */ free_xen_data(&__per_cpu_start[first_unused << PERCPU_SHIFT], __bss_start); data_size = (data_size + PAGE_SIZE + 1) & PAGE_MASK; @@ -448,6 +459,8 @@ void __init __start_xen(unsigned long mbi_p) .stop_bits = 1 }; + percpu_init_areas(); + set_intr_gate(TRAP_page_fault, &early_page_fault); /* Parse the command-line options. */ @@ -995,7 +1008,7 @@ void __init __start_xen(unsigned long mbi_p) init_apic_mappings(); - percpu_init_areas(); + percpu_free_unused_areas(); init_IRQ();